<template>
  <div>
    <a-form :model="formState">
      <a-form-item label="姓名">
        <a-input v-model:value="formState.name" />
      </a-form-item>
      <a-form-item label="电话">
        <a-input v-model:value="formState.phone" />
      </a-form-item>
      <a-form-item>
        <a-button type="primary" @click="onSubmit">提交</a-button>
      </a-form-item>
    </a-form>
  </div>
</template>

<script>
import router from "@router/index.js";
import { reactive, toRefs } from "@vue/reactivity";
import { $Storage } from "@utils/storage.js";
export default {
  setup() {
    const { isRegister, token } = router.currentRoute.value.query;
    const state = reactive({
      isRegister,
      token,
      formState:{
          name:"",
          phone:""
      }
    });
    
    if (state.isRegister === "1") {
      //判断是否有注册过
      $Storage.setItem("jwttoken", token);
      router.push("/home");
    }

    const onSubmit = ()=>{
        console.log("提交")
    }

    return {
      ...toRefs(state),
      onSubmit
    };
  },
};
</script>

<style>
</style>